<template>
<div>
    {{ $store.state.haha.txt }}
    <div>
    <nav-bar></nav-bar>
    <input class="inputs" type="text" v-model="txt" />
    <button type="button" name="button" @click="change" >change txt value</button>
    </div>
</div>
</template>

<script>
import NavBar from '~/components/NavBar';
export default {
    layout: 'store',
    components: {
        NavBar
    },
    data () {
        return {
            txt: ''
        }
    },
    methods: {
        change() {
            this.$store.commit("haha/change", this.txt);
            this.txt = '';
        }
    }
}
</script>

<style scoped>
    .inputs {
        background: #eee;
    }
</style>

